<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<link rel="stylesheet"
			href="/resources/plugins/datatables/dataTables.bootstrap.css" />
		
	</ui:define>

	<ui:define name="content">
		<h:form id="form">
			<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
				<p:commandButton value="是" type="button"
					styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
				<p:commandButton value="否" type="button"
					styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
			</p:confirmDialog>
			<p:growl id="msgs" showDetail="true" />
			<p:toolbar id="lib_toolbar" style="margin-top:5px;">
				<f:facet name="left">
					<p:commandButton icon="ui-icon-document" value="新建"
						update=":createForm:createDialog,msgs" oncomplete="PF('createDialog').show()"
						actionListener="#{standardDictController.preCreate()}" />
					<span class="ui-separator"> <span
						class="ui-icon ui-icon-grip-dotted-vertical" /></span>
					<p:commandButton icon="ui-icon-pencil" update=":createForm:createDialog"
						actionListener="#{standardDictController.preUpdate}"
						disabled="#{standardDictController.selected==null}" value="编辑"
						oncomplete="PF('createDialog').show()" />
					<span class="ui-separator"> <span
						class="ui-icon ui-icon-grip-dotted-vertical" /></span>
					<p:commandButton icon="ui-icon-trash" update=" record_list msgs"
						disabled="#{standardDictController.selected==null}"
						actionListener="#{standardDictController.delete}" value="删除">
						<p:confirm header="提示" message="删除后，该记录将无法恢复，确定删除选中的记录吗?"
							icon="ui-icon-alert" />
					</p:commandButton>
				</f:facet>
			</p:toolbar>
			<p:dataTable emptyMessage="无记录" style="margin-top:5px" var="record"
				widgetVar="record_list" id="record_list"
				selection="#{standardDictController.selectedRecords}"
				rowKey="#{record.id}" value="#{standardDictController.records}"
				paginator="true" rows="20" paginatorPosition="bottom"
				paginatorTemplate=" {FirstPageLink} {PreviousPageLink} {PageLinks} {CurrentPageReport} {NextPageLink} {LastPageLink}">
				<p:ajax event="rowSelect" update="form:lib_toolbar"
					listener="#{standardDictController.onRowSelect}"></p:ajax>
				<p:column selectionMode="multiple"
					style="width:35px;text-align:center" />
				<p:column headerText="编号" width="5%">
					<h:outputText value="#{record.orderNo}" />
				</p:column>
				<p:column headerText="内容" width="40%">
					<h:outputText value="#{record.name}" />
				</p:column>
				<p:column headerText="备注" width="45%">
					<h:outputText value="#{record.description}" />
				</p:column>
			</p:dataTable>
		</h:form>

		<h:form id="createForm">
			<p:dialog header="新建/编辑" height="300" width="400" modal="true"
				widgetVar="createDialog" resizable="false" dynamic="true"
				showEffect="explode" hideEffect="fold" id="createDialog">
				<p:toolbar>
					<f:facet name="left">
						<p:commandButton value="保存" icon="ui-icon-disk"
							update=":form:record_list  :form:msgs"
							oncomplete="PF('createDialog').hide()"
							actionListener="#{standardDictController.create}"
							style="margin-left:10px" />
						<p:commandButton icon="ui-icon-cancel" value="关闭" type="button"
							onclick="PF('createDialog').hide()" />
					</f:facet>
				</p:toolbar>
				<p:panelGrid style="margin-top:5px; width:100%" cellpadding="4">
					<p:row>
						<p:column style="font-weight: bold;">
							<h:outputText value="顺序号:" />
						</p:column>
						<p:column>
							<p:inputText required="true"
								value="#{standardDictController.current.orderNo}" />
						</p:column>
					</p:row>
					<p:row>
						<p:column style="font-weight: bold;">
							<h:outputText value="内容:" />
						</p:column>
						<p:column colspan="3">
							<h:inputTextarea id="name" style="width:98%;" required="true"
								value="#{standardDictController.current.name}"></h:inputTextarea>
						</p:column>
					</p:row>
					<p:row>
						<p:column style="font-weight: bold;">
							<h:outputText value="备注:" />
						</p:column>
						<p:column colspan="3">
							<h:inputTextarea style="width:98%;"
								value="#{standardDictController.current.description}"></h:inputTextarea>
						</p:column>
					</p:row>
				</p:panelGrid>
			</p:dialog>
		</h:form>
	</ui:define>
</ui:composition>
